package com.heima.article.listener;

import com.heima.article.service.ApArticleConfigService;
import com.heima.article.service.ApArticleService;
import com.heima.common.constants.ArticleConstants;
import com.heima.common.constants.BehaviorConstans;
import com.heima.common.constants.WemediaConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ArtilceIsDownListener {
    @Autowired
    private ApArticleConfigService apArticleConfigService;
    @Autowired
    private ApArticleService apArticleService;

    @KafkaListener(topics = WemediaConstants.WM_NEWS_UP_OR_DOWN_TOPIC)
    public void onMessage(String message){
        apArticleConfigService.downOrLoad(message);
    }

    @KafkaListener(topics = ArticleConstants.HOT_ARTICLE_SCORE_TOPIC)
    public void demo(String message){
        log.info("开始处理消息");
        apArticleService.updateScore(message);
    }
}
